package com.rjwh.dingdong.client.network;

import com.aishua.lib.task.AsResult;
import com.rjwh.dingdong.client.util.AsyncTask;

import java.util.Map;

/**
 * Soap请求具体操作类
 *
 * @author 王小珂
 * @ClassName WebServiceReqTask
 * @Description TODO(这里用一句话描述这个类的作用)
 * @date 2015-11-19 下午4:37:42
 * @history 1.YYYY-MM-DD author: description:
 */
public class SoapReqTask extends AsyncTask<Void, Integer, AsResult> {
    private int businessType;
    private Map<String, String> paramsMap;
    private boolean isRefresh;
    private HttpWebServiceCallBack callBack;

    public SoapReqTask(int businessType, Map<String, String> params,
                       boolean isRefresh, HttpWebServiceCallBack callBack) {
        this.businessType = businessType;
        this.paramsMap = params;
        this.isRefresh = isRefresh;
        this.callBack = callBack;
    }

    @Override
    protected void onProgressUpdate(Integer... values) {
        // TODO Auto-generated method stub
        super.onProgressUpdate(values);
    }

    @Override
    protected void onPostExecute(AsResult as) {
        if (callBack != null) {
            callBack.onServerDataAcquired(businessType, as, isRefresh);
        }
    }

    @Override
    protected AsResult doInBackground(Void... params) {
        // TODO Auto-generated method stub
        final NetConnection mNetConnection = NetConnection.getInstant();
        return mNetConnection.getNetJsonData(businessType, paramsMap);
    }

}
